/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package publicRelations.beans;

import abstractClasses.AbstractEntityList;
import entities.Candidate;
import entities.PublicRelations;
import entities.PublicRelationsCandidate;
import facades.CandidateFacade;
import facades.PublicRelationsCandidateFacade;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;
import javax.inject.Named;
import qualifiers.LoggedIn;

/**
 *
 * @author Alvaro
 */
@Named(value = "publicRelationsBeanList")
@SessionScoped
public class PublicRelationsListBean extends AbstractEntityList<PublicRelationsCandidate, PublicRelationsCandidateFacade> implements Serializable {
    
    @Inject
    private PublicRelationsCandidateFacade publicRelationsCandidateFacade;
    @Inject
    private CandidateFacade candidateFacade;
    @Inject
    @LoggedIn
    private PublicRelations publicRelations;
    /**
     * Creates a new instance of AdminCompanyBean
     */
    public PublicRelationsListBean() {
    }
    
    @PostConstruct
    @Override
    public void init(){
        setEntityFacade(getEntityFacadeInstance().get());
        this.setEntityList(publicRelationsCandidateFacade.findByPublicRelationsIdUser(getPublicRelations().getUser().getIdUser()));
    }

    //@Override
    public String redirectToViewEntity() {
        return null;
    }
    
    public String getPublicRelationLink(){
        return "http://therecruitery.com/NewCandidateRegister/"+getPublicRelations().getIdPublicRelationships();
    }
    public Boolean isValidCandidate(Candidate candidate){
        Boolean res = false;
        res=candidateFacade.isValidCandidate(candidate);
        return res;
        
    }

    /**
     * @return the publicRelations
     */
    public PublicRelations getPublicRelations() {
        return publicRelations;
    }

    /**
     * @param publicRelations the publicRelations to set
     */
    public void setPublicRelations(PublicRelations publicRelations) {
        this.publicRelations = publicRelations;
    }
}
